/**
 * 会员管理初始化
 */
var OptLog = {
    id: "OptLogTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
OptLog.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '姓名', field: 'userName', align: 'center', valign: 'middle', sortable: true},
        {title: '绑定手机', field: 'loginAccount', align: 'center', valign: 'middle', sortable: true},
        {title: '用户角色', field: 'ismember', align: 'center', valign: 'middle', sortable: true},
        {title: '比豆余额', field: 'remainPart', align: 'center', valign: 'middle', sortable: true},
        {title: '冻结中比豆', field: 'freezePart', align: 'center', valign: 'middle', sortable: true},
        {title: '注册时间', field: 'createTime', align: 'center', valign: 'middle', sortable: true},];
};

/**
 * 检查是否选中
 */
OptLog.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录！");
        return false;
    }else{
        OptLog.seItem = selected[0];
        return true;
    }
};



/**
 * 查询表单提交参数对象
 * @returns {{}}
 */
OptLog.formParams = function() {
    var queryData = {};
    queryData['loginAccount'] = $("#loginAccount").val();
    queryData['userName'] = $("#userName").val();
//  queryData['45677'] = 5666;
//  alert($("#name").val())
    queryData['ismember'] = $("#ismember").val();
    queryData['createTime'] = $("#createTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
}

/**
 * 查询会员列表
 */
OptLog.search = function () {

    OptLog.table.refresh({query: OptLog.formParams()});
};

$(function () {
    var defaultColunms = OptLog.initColumn();
    /*var table = new BSTable(OptLog.id, "/vipManage/queryVipManage?userId=admin", defaultColunms);*/
    var table = new BSTable(OptLog.id, "/vipManage/queryVipManage?start=0&end=10000", defaultColunms);
    table.setPaginationType("client");
    table.setQueryParams(OptLog.formParams());
    OptLog.table = table.init();
});
